# _*_ coding: utf-8 _*_
# @Time : 2025-10-22 10:30
# @Author : wf
import time

import pyautogui
import pygetwindow as gw

# 每次延迟 1s
pyautogui.PAUSE = 1
pyautogui.FAILSAFE = False

time.sleep(10)
all_titles = gw.getAllTitles()

print(all_titles)

window = gw.getWindowsWithTitle('开发云桌面_非编-研发中心228')[0]
window2 = gw.getWindowsWithTitle('（研发S8）云桌面 - Desktop Viewer')[0]
window3 = gw.getWindowsWithTitle('图吧工具箱简易屏幕测试')[0]
num = 1
while num < 700:
    print(time.ctime(), num)

    try:
        if window.isMinimized:
            window.maximize()
        window.activate()
    except Exception as e:
        print("窗口操作失败：", e)

    time.sleep(2)
    pyautogui.moveTo(1280, 720)
    pyautogui.click()
    pyautogui.scroll(-100)
    try:
        if window.isMaximized:
            window.minimize()
        window.activate()
    except Exception as e:
        print("窗口操作失败：", e)

    try:
        window3.activate()
    except Exception as e:
        print("窗口3操作失败：", e)
    time.sleep(10)
    try:
        if window2.isMinimized:
            window2.maximize()
        window2.activate()
    except Exception as e:
        print("窗口2操作失败：", e)
    time.sleep(2)
    pyautogui.moveTo(1280, 720)
    pyautogui.click()
    pyautogui.scroll(-100)
    try:
        window2.activate()
    except Exception as e:
        print("窗口2操作失败：", e)

    try:
        window3.activate()
    except Exception as e:
        print("窗口3操作失败：", e)

    num += 1
    time.sleep(1500)

